package com.lucun.es_transaction.controller;

import com.lucun.es_transaction.config.RolePermission;
import com.lucun.es_transaction.entity.Authentication;
import com.lucun.es_transaction.service.AuthenticationService;
import com.lucun.es_transaction.util.AuthorityUtil;
import com.lucun.es_transaction.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/authentication")
public class AuthenticationController {
    @Autowired
    AuthenticationService authenticationService;

    //    添加认证信息
    @RequestMapping("/insert")
    @RolePermission(role=AuthorityUtil.THIRD)
    public JsonResult<?> Insert(@RequestBody Authentication authentication, HttpServletRequest request) {
        return authenticationService.insert(authentication, request);
    }

    //    删除
    @RolePermission(role = AuthorityUtil.THIRD)
    @RequestMapping("/delete")
    public JsonResult<?> Delete(@RequestBody Authentication authentication, HttpServletRequest request) {
        return authenticationService.delete(authentication, request);
    }
}
